import React, { useEffect, useState } from 'react';
import {useNavigate,useParams} from 'react-router-dom'
import axios from 'axios'
const Index = () => {
    const navigate =useNavigate()
    let params =useParams();
    console.log(params);
    const [top,setMusic] =useState({});
    const fechData =async ()=>{
        var res =await axios.get(`http://122.112.161.135:4000/api/movieDetail?id=${params.id}`)
        console.log(res.data.res);
        setMusic(res.data.res[0])
    }
    
    useEffect(()=>{
        fechData()
    },[])
    return (
        <div>
            <img onClick={()=>{navigate(-1)}} src={top.pic} alt=""  />
            <p>{top.title}</p>
        </div>
    );
}

export default Index;
